<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>OpenFTP</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">OpenFTP()</font></b></p>
<p><b>语法</b></p><blockquote>

Result = <font color="#3A3966"><b>OpenFTP</b></font>(#Ftp, ServerName$, User$, Password$ [, Passive [, Port]])</blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Tries to open a connection on the specified FTP server. 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Ftp</i></td>
<td width="90%"> 
The number to identify the new connection. <a href="../reference/purebasic_objects.html">#PB_Any</a> 可以用来自动生成这个编码. 

</td></tr>
<tr><td><i>ServerName$</i></td>
<td> 
 
The URL or address of the server to connect to. 

 

</td></tr>
<tr><td><i>User$</i></td>
<td> 
 
The user name to authenticate on the server. 

 

</td></tr>
<tr><td><i>Password$</i></td>
<td> 
 
The password to authenticate on the server. 

 

</td></tr>
<tr><td><i>Passive (optional)</i></td>
<td> 
 
Enables or disables passive mode for the connection (valid values are <font color="#924B72">#True</font> or <font color="#924B72">#False</font>). 
If this parameter is not specified, passive mode will be used. 

 

</td></tr>
<tr><td><i>Port (optional)</i></td>
<td> 
 
The port to use for the connection. The default is port 21. 

 

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



Returns nonzero if the connection was established correctly and zero if there was an error. 
If <font color="#924B72">#PB_Any</font> is used as the #Ftp parameter then the generated number for the connection 
is returned on success. 

 

</blockquote><p><b>备注</b></p><blockquote>

<a href="../network/initnetwork.html">InitNetwork()</a> has to be called before using this command, as all the FTP commands 
are based on the <a href="../network/index.html">network library</a>. 

 

</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">  InitNetwork</font>()
  
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenFTP</font>(0, "ftp.free.fr", "anonymous", "")
    <b><font color="#3A3966">Debug</font></b> "Successfully connected"
  <b><font color="#3A3966">Else</font></b>
    <b><font color="#3A3966">Debug</font></b> "Can't connect to ftp.free.fr"
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="closeftp.html">CloseFTP()</a>, <a href="setftpdirectory.html">SetFTPDirectory()</a>, <a href="receiveftpfile.html">ReceiveFTPFile()</a>, <a href="sendftpfile.html">SendFTPFile()</a>, <a href="examineftpdirectory.html">ExamineFTPDirectory()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=nextftpdirectoryentry.html>NextFTPDirectoryEntry()</a> - <a href="index.html">Ftp Index</a> - <a href="receiveftpfile.html">ReceiveFTPFile()</a> -&gt;<br><br>

</body></html>